//
//  WithdrawAccountCell.m
//  GasBusiness
//
//  Created by zfc on 2021/8/22.
//

#import "WithdrawAccountCell.h"

@interface WithdrawAccountCell ()
@property (nonatomic, strong) UILabel *accountTypeLab;
@property (nonatomic, strong) UILabel *accountLab;
@end

@implementation WithdrawAccountCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setUI {
    self.contentView.backgroundColor = ColorF5;
    UIView *backView = [[UIView alloc] init];
    backView.backgroundColor = WhiteColor;
    [self.contentView addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.contentView);
        make.leading.equalTo(self.contentView);
        make.top.equalTo(self.contentView);
    }];

    UILabel *accountTypeLab = [[UILabel alloc] init];
    accountTypeLab.text = @"微信账号";
    accountTypeLab.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
    accountTypeLab.textColor = Color333;
    [backView addSubview:accountTypeLab];
    self.accountTypeLab = accountTypeLab;
    [accountTypeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(backView).offset(15);
        make.leading.equalTo(backView).offset(15);
        make.centerY.equalTo(backView);
    }];

    UILabel *accountLab = [[UILabel alloc] init];
    accountLab.text = @"";
    accountLab.font = [UIFont systemFontOfSize:16 weight:UIFontWeightBold];
    accountLab.textColor = Color999;
    [backView addSubview:accountLab];
    self.accountLab = accountLab;
    [accountLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(accountTypeLab.mas_trailing);
        make.centerY.equalTo(backView);
    }];

    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = ColorF5;
    [backView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(backView);
        make.height.mas_equalTo(1);
        make.leading.equalTo(backView);
        make.trailing.equalTo(backView);
    }];
}

- (void)setDic:(NSDictionary *)dic {
    _dic = dic;

    NSInteger account_type = [dic[@"account_type"] intValue];
    NSString *type = @"其他账户";
    if (account_type == 1) { //银行卡
        type = @"银行卡";
    }

    if (account_type == 2) { //微信
        type = @"微信";
    }

    if (account_type == 3) { //支付宝
        type = @"支付宝";
    }

    self.accountTypeLab.text = type;
    self.accountLab.text = [NSString stringWithFormat:@"%@", [Untils phoneNumberHiddenCenter:dic[@"mobile"]]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
